<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Admin\Controller;
use Admin\Model\AuthGroupModel;
use COM\Page;
/**
 * 后台内容控制器
 * @author huajie <banhuajie@163.com>
 */

class LeavewordController extends \Admin\Controller\AdminController{

    function index()
    {
        $list = M('document')->select();
        //var_dump($list);
        header("content-type:text/html;charset=utf8");
        $Leaveword = D('Leaveword');
        $list = $this->lists($Leaveword);
        $this->assign('list',$list);
        $this->display();
    }
    function add(){
        $this->display();
    }
    function save(){
        $data = I();
        if(isset($data['id'])){
            $data['rtime'] = time();
            $data['reply_userid'] = UID;
        }else{
        $data['ctime'] = time();

        }
        $res = D('Leaveword')->update($data);
        if(!res){
            $this->error( D('Leaveword')->getError());
        }else{
            if(!$res['id']){
                $this->success('添加成功',U('index'));
            }else{
                $this->success('更新成功',U('index'));
            }
        }
    }
    function delete(){
        $id = $_GET['id'];
        $res = D('Leaveword')->delete($id);
        $this->success('删除成功',U('index'));


    }
    function update()
    {
        $list = M('document')->select();
        //var_dump($list);
        header("content-type:text/html;charset=utf8");
        $Leaveword = D('Leaveword');
        $list = $this->lists($Leaveword);
        //var_dump($list);die;
        $this->assign('list',$list);

        $this->display();
    }
    function re_ply()
    {
        $list = M('document')->select();
        //var_dump($list);
        header("content-type:text/html;charset=utf8");
        $Leaveword = D('Leaveword');
        $list = $this->lists($Leaveword);
        //var_dump($list);die;
        $this->assign('list',$list);

        $this->display();}

}
